package com.ailight.smart.ai.enums;

import lombok.Getter;

import java.util.List;
import java.util.Objects;

@Getter
public enum OperationTypeEnums {
    /**
     * 开启自动模式
     */
    ENABLE_AUTO_MODE(0, "auto_mode", ModelEnums.AUTO_MODE, "开启自动模式参数"),

    /**
     * 开启手动模式
     */
    ENABLE_MANUAL_MODE(0, "manual_mode", ModelEnums.MANUAL_M0DE, "开启手动模式参数"),

    /**
     * 一档
     */
    ENABLE_GEAR_ONE(1, "gear_one", ModelEnums.MANUAL_M0DE, "手动模式下：一档参数"),

    /**
     * 二档
     */
    ENABLE_GEAR_TWO(2, "gear_two", ModelEnums.MANUAL_M0DE, "手动模式下：二档参数"),

    /**
     * 三档
     */
    ENABLE_GEAR_THREE(3, "gear_three", ModelEnums.MANUAL_M0DE, "手动模式下：三档参数"),

    /**
     * 关灯
     */
    ENABLE_LIGHT_OFF(0, "manual_off", ModelEnums.MANUAL_M0DE, "关灯参数"),
    ;

    /**
     * 操作类型--挡位
     */
    private final int gearType;
    /**
     * 操作名称
     */
    private final String opeName;

    /**
     * 对应的模式
     */
    private final ModelEnums modelEnums;

    private final String desc;

    OperationTypeEnums(int gearType, String opeName, ModelEnums modelEnums, String desc) {
        this.gearType = gearType;
        this.opeName = opeName;
        this.modelEnums = modelEnums;
        this.desc = desc;
    }

    public static OperationTypeEnums getOperationTypeEnums(String opeName) {
        for (OperationTypeEnums operationTypeEnums : OperationTypeEnums.values()) {
            if (Objects.equals(operationTypeEnums.getOpeName(), opeName)) {
                return operationTypeEnums;
            }
        }
        return ENABLE_GEAR_ONE;
    }

    public static List<String> getOperationTypeNames() {
        return List.of(
                ENABLE_AUTO_MODE.getOpeName(),
                ENABLE_MANUAL_MODE.getOpeName(),
                ENABLE_GEAR_ONE.getOpeName(),
                ENABLE_GEAR_TWO.getOpeName(),
                ENABLE_GEAR_THREE.getOpeName(),
                ENABLE_LIGHT_OFF.getOpeName(),
                "turn_light"
        );
    }
}
